package com.hellobike.haxing.modules.order.job;

import com.hellobike.haxing.common.constant.CacheConstant;
import com.hellobike.haxing.common.util.RedisUtil;
import com.hellobike.haxing.modules.order.service.IOrderService;
import com.hellobike.haxing.modules.wms.facade.WmsSyncFacade;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 团长佣金
 * 无售后-订单完成
 * 有售后-无售后申请的订单
 */
@Slf4j
@Component
public class ShopCommissionJob {

    @Autowired
    private IOrderService orderService;
    @Autowired
    private RedisUtil redisUtil;
    @Scheduled(cron = "0 0 0/2 * * ? ")
    public void execute(){
        Object result = redisUtil.get(CacheConstant.SHOP_ORADER_AMOUNT_JOB);
        if(result!=null){return;}
        redisUtil.set(CacheConstant.SHOP_ORADER_AMOUNT_JOB,1,600);
        log.info("==订单完成团长佣金计算开始执行==");
        orderService.updateShopCommission();
    }
}
